import React, {Component} from 'react';
import Container from '@icedesign/container';
import {Grid,Loading} from '@icedesign/base';
import BaseUserInfo from './components/BaseUserInfo';
import API from '../../../../tools/API';
import BaseUserHeadImg from './components/BaseUserHeadImg';
const {Row, Col} = Grid;
import './BaseSetting.scss';
/**
*  基础设置
*/
export default class BaseSetting extends Component{

  constructor(props) {
     super(props);
     this.state = {
       user:{},
       isLoading:true
     }
  }


  //初始化
  componentWillMount(){
    //获取当前登录用户信息
    API.getUserInfo().then((res) => {
      this.state.user = res.result;
      this.state.isLoading = false;
      this.setState(this.state);
    })
  }

  render(){
    return(
      <div>
        <Container title={"基本设置"} loading={this.state.isLoading}>
            {
              this.state.isLoading?
                <Loading shape="fusion-reactor" color="#fff">
                </Loading>
              :
                <Row justify='center' wrap={true} gutter={20}>
                  <Col s='12' xxs="24">
                    <BaseUserInfo user={this.state.user} />
                  </Col>
                  <Col s='12' xxs="24">
                    <BaseUserHeadImg user={this.state.user} />
                  </Col>
                </Row>
            }
        </Container>
      </div>
    )
  }

}
